from tkinter import *

root = Tk()

def callback():
    fileName = filedialog.askopenfilename(filetypes=[('PNG','.png')])
    print(fileName)

Button(root,text='打开文件',command=callback).pack()

mainloop()
